

-- ----------------------------
--  Table structure for `weixin_user`
-- ----------------------------
DROP TABLE IF EXISTS `weixin_user`;
CREATE TABLE `weixin_user` (
  `id` varchar(64) NOT NULL  COMMENT '用户id',
  `username` varchar(64) NOT NULL COMMENT '真实姓名',
  `login_name` varchar(64) DEFAULT NULL COMMENT '登录名字',
  `password` varchar(64) NOT NULL COMMENT '用户密码密文',
  `mobile` varchar(20) DEFAULT NULL COMMENT '手机号码',
  `person_number` varchar(60) DEFAULT NULL COMMENT '身份证号码',
  `sex` int(4) DEFAULT '1' COMMENT '性别(1.男 0 女)',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `lastLogin_time` datetime DEFAULT NULL,
  `status` tinyint(4) DEFAULT NULL COMMENT '账户状态(1.正常 2.锁定 )',
   deleted  int(4) default 1 comment '是否删除(1未删除；0已删除)',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `login_name` (`login_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信用户';

-- ----------------------------
--  Records of `weixin_user`
-- ----------------------------
BEGIN;
INSERT INTO `weixin_user` VALUES ('2', '周大大', '18696562966', '1', '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92', '12343434322', '1', '明明白白驾校', '343243234345', '2021-02-22 20:02:49', '2021-06-13 23:04:23', '2022-02-22 20:55:19', '1', null), ('31', '1344487766', '1344487766', '0', 'e2f2814cfb71ca361de32f8a172d282e41d8fa4fd3dad1ac2c184ad380b7f6a1', '1344487766', '1387981460138471425', '01', '', '2021-04-30 22:37:28', null, '2021-07-23 00:00:00', '0', '1'), ('33', '33666', '33333', '1', '216e683ff0d2d25165b8bb7ba608c9a628ef299924ca49ab981ec7d2fecd6dad', '18676543568', '1', null, '4532876538987698732', '2021-05-17 15:05:52', null, '2021-05-12 00:00:00', '1', '1'), ('34', '55', '55', '0', '02d20bbd7e394ad5999a4cebabac9619732c343a4cac99470c03e23ba2bdc2bc', '13332322222', '1', '总公司', '324333434334', '2021-05-17 15:25:23', null, '2021-05-28 00:00:00', '1', '1');
COMMIT;

delimiter $$
drop function if exists get_child_list$$
create function get_child_list(in_id varchar(64)) returns varchar(5000)
begin
    declare ids varchar(5000) default '';
    declare tempids varchar(5000);

    set tempids = in_id;
    while tempids is not null do
            set ids = CONCAT_WS(',',ids,tempids);
            select GROUP_CONCAT(id) into tempids from category where FIND_IN_SET(parent_id,tempids)>0;
        end while;
    return ids;
end
$$
delimiter ;


--



